Repository navigation
fix(frankenphp): copy vendor into the production image and enable the entrypoint - #33
Merged
Merged
Conversation
… entrypoint The composer-builder stage ran composer install without first copying composer.json or composer.lock into the stage, and the production stage never copied the resulting vendor/ out of it. vendor/ is gitignored in the application, so COPY . ./ cannot supply it either, and the published image shipped without dependencies. The docker-php-entrypoint COPY was commented out, so the entrypoint never ran. Its job is to run artisan deploy commands.
The entrypoint called `frankenphp "$@"` where the base image calls `frankenphp run "$@"`. With the container command `--config ...` this produced `Error: unknown flag: --config` and the container exited. The defect was invisible while the entrypoint COPY was commented out.
The application ships a .env.production in its repository, and the production image now installs it as .env so the container starts configured. The copy is last so that COPY . ./ cannot clobber it, and the application's .dockerignore excludes .env.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The FrankenPHP production image now ships the application's Composer dependencies and runs its entrypoint.
Why
Two defects made the published image unusable:
composer-builderstage rancomposer installwithout first copyingcomposer.jsonorcomposer.lockinto the stage, and theproductionstage never copied the resultingvendor/out of it.vendor/is gitignored in the application, soCOPY . ./cannot supply it either — the image shipped without dependencies and the app fatally errored onrequire /app/vendor/autoload.php.docker-php-entrypoint.shCOPYwas commented out, so the entrypoint never ran. Its job is to runartisandeploy commands.Behavior
composer-buildercopiescomposer.jsonandcomposer.lockbeforecomposer install, so the stage has a manifest to install from and the layer caches when only source changes.productioncopiesvendor/fromcomposer-builderafterCOPY . ./.--chmod=755and now runs.The commented-out
caddy-builderblock and frankenphp binaryCOPY, and the CaddyfileCOPY, are untouched — out of scope.Done when
git diffshows exactly the three changes above.docker build --check -f frankenphp/Dockerfile .completes with no warnings.productiontarget succeeds and the image contains/app/vendor/autoload.php(verified by the orchestrator after this PR).